package jxerializeml.clues.fields;

import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import java.lang.annotation.Retention;

/**
 * <p>
 *   This annotation tells to the deserializer that field
 *   shouldn't be assigned directly, but using proper setter.
 * </p>
 * <p>
 *   If this annotation is used, but any setter is found,
 *   depending on the configuration it may end up with an
 *   error or with setting the field directly.
 * </p>
 * 
 * @author Tomáš Zíma
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface InvokeSetter {
	/**
	 * @return
	 *     Name of the setter to be used. If empty, deserializer will
	 *     attempt to detect the proper setter automatically.
	 */
	public String methodName() default "";
	
	/**
	 * @return
	 *     True means that usage of the setter is necessary and when it's
	 *     not found, error should be triggered. False means, that it should
	 *     be used only if possible.
	 */
	public boolean mandatory() default true;
}
